package com.iweb.service.impl;

import com.iweb.model.ImageFile;
import com.iweb.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.iweb.repository.FileRepository;

@Service
public class ImageServiceImpl implements ImageService {

    @Autowired
    private FileRepository fileRepository;

    @Override
    public ImageFile saveFile(ImageFile file) {
        return fileRepository.save(file);
    }

    @Override
    public void removeFile(String id) {
        fileRepository.deleteById(id);
    }

    @Override
    public ImageFile getFileById(String id) {
        return fileRepository.findById(id).get();
    }
}
